<?php
/**
 * (exporter)
 */
namespace App\Exporter\Products;

use App\Models\Product\ProductClassify;
use App\Models\Product\ProductSku;
use App\Util\User;
use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithMapping;
class SkuTrashedExporter extends ExcelExporter implements WithMapping
{
    protected $fileName = '产品回收站.csv';

    protected $headings = ['SKU','PartNo.','组合','组合规则','是否在售','名称','季节性','品类','产品状态','负责人','创建人','创建时间'];

    public function map($model) : array
    {
        return [
            $model->psku_code,
            $model->part_number,
            ProductSku::$_isMix[$model->is_mix],
            $model->mix_rule,
            ProductSku::$_isSales[$model->is_sales],
            $model->psku_cn,
            ProductClassify::$_season[$model->classify->season],
            $model->classify->title,
            ProductSku::$_pSkuStatus[$model->psku_status],
            User::getUsernameById($model->muser_id),
            User::getUsernameById($model->cuser_id),
            $model->created_at,
        ];
    }

}
